﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using COM.PreAlarm.BLL;
using COM.PreAlarm.Model;

namespace TcpListen_HeNan
{
    public  class Common
    {
        //将当前年月日转化位字符串“2012-03-01”
        public string GetDateString()
        {
            DateTime dt = DateTime.Now;
            int dty = dt.Year;
            int dtm = dt.Month;
            int dtd = dt.Day;
            string ymd = dty + "-" + GetMonthOrDay(dtm) + "-" + GetMonthOrDay(dtd);
            return ymd;
        }

        //处理日期月份或日小于10的数据 小于10的前面加0
        private string GetMonthOrDay(int x)
        {
            string dtmd;
            if (x < 10)
            {
                dtmd = "0" + x;
            }
            else
            {
                dtmd = x.ToString();
            }
            return dtmd;
        }

        //设置设备状态的初始化的值
        public static Equip_OnlineInfo GetEquipOnlineInfo()
        {
            //初始化设备状态信息
            Equip_OnlineInfo eof = new Equip_OnlineInfo();
            eof.Equip_No = "123";//先置为空
            eof.Rpt_DateTime = new Common().GetDateString();
            eof.Online_00 = 0;
            eof.Online_01 = 0;
            eof.Online_02 = 0;
            eof.Online_03 = 0;
            eof.Online_04 = 0;
            eof.Online_05 = 0;
            eof.Online_06 = 0;
            eof.Online_07 = 0;
            eof.Online_08 = 0;
            eof.Online_09 = 0;
            eof.Online_10 = 0;
            eof.Online_11 = 0;
            eof.Online_12 = 0;
            eof.Online_13 = 0;
            eof.Online_14 = 0;
            eof.Online_15 = 0;
            eof.Online_16 = 0;
            eof.Online_17 = 0;
            eof.Online_18 = 0;
            eof.Online_19 = 0;
            eof.Online_20 = 0;
            eof.Online_21 = 0;
            eof.Online_22 = 0;
            eof.Online_23 = 0;
            eof.Online_Total = 0;
            eof.Ext = "无";
            return eof;
        }


    }
}
